<?php
use yii\grid\GridView;
use common\helpers\Html;
use common\helpers\ImageHelper;

$this->title = '入金记录';
$this->params['breadcrumbs'][] = ['label' => $this->title];
?>

<div class="row">
    <div class="col-xs-12">
        <div class="box">
            <div class="box-header">
                <h3 class="box-title"><?= $this->title; ?></h3>

            </div>
            <div class="box-body table-responsive">
                <?= GridView::widget([
                    'dataProvider' => $dataProvider,
                    'filterModel' => $searchModel,
                    //重新定义分页样式
                    'tableOptions' => ['class' => 'table table-hover'],
                    'columns' => [
                        [
                            'class' => 'yii\grid\SerialColumn',
                        ],
                        [
                            'attribute' => 'openid',
                            'value' => function ($model) {
                                return $model->member->username;
                            },
                            'filter' => false,
                            'format' => 'raw',
                        ],
                        'order_sn',
                        [
                            'label'=> '方向',
                            'filter' => false, //不显示搜索框
                            'value' => function ($model) {
                                if ($model->order_group=='in') {
                                    return '入金';
                                }else{
                                    return '出金';
                                }
                            },
                            'format' => 'raw',
                        ],
                        [
                            'label'=> '审核时间',
                            'filter' => false, //不显示搜索框
                            'value' => function ($model) {
                                return date('Y-m-d H:i:s',$model->updated_at);
                            },
                            'format' => 'raw',
                        ],
                        [
                            'label'=> '审核情况',
                            'filter' => false, //不显示搜索框
                            'value' => function ($model) {
                                if ($model->status=='-1') {
                                    return '未通过';
                                }else{
                                    return '通过';
                                }
                            },
                            'format' => 'raw',
                        ],
//                        [
//                            'header' => "操作",
//                            'class' => 'yii\grid\ActionColumn',
//                            'template'=> '{statusy} {statysn}  {recharge} {edit} {status} {destroy}',
//                            'buttons' => [
//                                'statusy' => function ($url, $model, $key) {
//                                    return Html::linkButton(['ajax-edit', 'id' => $model->id,'status'=>'1'], '通过', [
//                                        'class' => 'btn btn-success btn-sm',
//                                    ]);
//                                },
//                                'statysn' => function ($url, $model, $key) {
//                                    return Html::linkButton(['ajax-edit', 'id' => $model->id,'status'=>'-1'], '驳回', [
//                                        'class' => 'btn btn-danger btn-sm',
//                                    ]);
//                                },
//                                'recharge' => function ($url, $model, $key) {
//                                    return Html::linkButton(['recharge', 'id' => $model->id], '充值', [
//                                        'data-toggle' => 'modal',
//                                        'data-target' => '#ajaxModal',
//                                    ]);
//                                },
//                                'edit' => function ($url, $model, $key) {
//                                    return Html::edit(['edit', 'id' => $model->id]);
//                                },
//                                'status' => function ($url, $model, $key) {
//                                    return Html::status($model->status);
//                                },
//                                'destroy' => function ($url, $model, $key) {
//                                    return Html::delete(['destroy','id' => $model->id]);
//                                },
//                            ],
//                        ],
                    ],
                ]); ?>
        </div>
    </div>
</div>